#ifndef SURFACE_H_
#define SURFACE_H_

// INCLUDES //
#include "SDL/SDL_image.h"
#include <string>
//////////////

using namespace std;

/**
* A wrapper for SDL_SURFACE.
* 
* @author dfoelber
**/
class Surface
{
public:
	/**
	* Default constructor
	**/
	Surface();

	/**
	* Constructor
	* 
	* @param surface An SDL surface to wrap.
	**/
	Surface( SDL_Surface* surface );
	
	/**
	* Deconstructor
	**/
	~Surface();
	
	/**
	* Accessor to the wrapped SDL_SURFACE.
	* 
	* @return The wrapped surface
	**/
	SDL_Surface* GetSurface();
	
	/**
	* Gets the surface's width
	* 
	* @return The surface's width or -1 if not loaded.
	**/
	int GetWidth();
	
	/**
	* Gets the surface's height
	* 
	* @return The surface's height or -1 if not loaded.
	**/
	int GetHeight();
	
	/**
	* Load's the resource from the given location
	* 
	* @param filename The filename
	* @return Success
	**/
	bool LoadResource( string filename );
	
	/**
	* Scales based on the given factor
	* 
	* @param factor The scaling factor
	**/
	void Scale( double factor );
	
	/**
	* Applies this surface to another surface
	* 
	* @param dest Destination surface
	* @param x The X coordinate of the destination
	* @param y The Y coordinate of the destination
	**/
	void Apply( Surface* dest, int x, int y );
	
	/**
	* Applies this surface to another surface
	* 
	* @param dest Destination surface
	* @param sourceX The X coordinate of the desired section
	* @param sourceY The Y coordinate of the desired section
	* @param sourceWidth The width of the desired section
	* @param sourceHeight The height of the desired section
	* @param destX The X coordinate of the destination
	* @param destY The Y coordinate of the destination
	**/
	void Apply( Surface* dest, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY );
	
private:
	/**
	* SDL's surface structure
	**/
	SDL_Surface* 		surface;
	
	/**
	* The resource's filename
	**/
	string				filename;
};

#endif /*SURFACE_H_*/
